{% extends "tmpl/base.html" %}

{% block scripts %}
<script>
var workIsDone = false;

window.onbeforeunload = confirmBrowseAway;

function confirmBrowseAway()
{
  if (!workIsDone) {
      return "Etes vous sur de faire ça ? Si vous quittez cette page " +
	      "maintenant, votre travail ne sera PAS sauvegardé !";
	}
}

function Ok_WorkisDone()
{
	// The user has finished their work, so we don't
	// need a warning anymore!
	workIsDone = true;
}
</script>

{% endblock %}

{% block nav %}
<p />
{% endblock %}

{% block content %}

    <form id="base_form" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    <fieldset>
    <legend>
		{% if TITRE_PAGE %}
			{{ TITRE_PAGE }}
		{% else %}
			"TITRE DE LA PAGE"
		{% endif %}
	</legend>

    <ol>
	<p>{{ form.non_field_errors }}</p>
	<p>{{ form.docfile.label_tag }} {{ form.docfile.help_text }}</p>
	<p>
	{{ form.docfile.errors }}
	{{ form.docfile }}
	</p>
    </ol>
    </fieldset>

    <div id="error">
        {{ field.errors }}
    </div>

    <fieldset>
    <table>
    <tr><td>
    <button type="submit" name="VALID" value="VALID" onclick="Ok_WorkisDone()" /> Validation </button>
    </td> <td>
    <button type="submit" name="VALID" value="ANNUL" onclick="Ok_WorkisDone()" /> Annulation </button>
    </td></tr>
    </table>
    </fieldset>
    </form>

{% endblock %}
